The formal definition of algorithm is: a process or set of rules for calculating or problem-solving. In the world of software, different algorithms are used for programming. Some viruses also include computer algorithms in their code.